package com.jevons.geo_lib.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * Copyright 2020 JxGIS
 *
 * @file StringUtils
 * @auth linaisheng
 * Created on 2024/4/29.
 * Description：
 */
public class StringUtils {

    /**
     * Return whether the string is null or 0-length.
     *
     * @param s The string.
     * @return {@code true}: yes<br> {@code false}: no
     */
    public static boolean isEmpty(final CharSequence s) {
        return s == null || s.length() == 0;
    }

    public static boolean isNotEmpty(final CharSequence s) {
        return !isEmpty(s);
    }

    public static String getUUID() {
        return UUID.randomUUID().toString();
    }


    public static String generateId() {
        return getUUID().replace("-", "");
    }



    /**
     * SimpleDateFormat 日期格式：yyyy-MM-dd HH:mm:ss
     */
    public static final SimpleDateFormat FORMAT_DATE_TIME = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    /**
     * 获取当前时间--格式yyyy-MM-dd HH:mm:ss
     *
     * @return 按yyyy-MM-dd HH:mm:ss格式转化后的当前时间
     */
    public static String getCurrentTime() {
        return FORMAT_DATE_TIME.format(new Date());
    }

}